import 'package:food_hub_app/models/stats.dart';
import 'package:food_hub_app/utils/http_util.dart';
import 'package:food_hub_app/utils/index.dart';

Future<SummaryStats> queryStatsApi() {
  return HttpUtil().get<SummaryStats>(
    "/food/stats",
    converter: (data) => SummaryStats.fromJson(data),
  );
}

Future<List<ChartData>> queryRecordStatsApi() {
  return HttpUtil().get<List<ChartData>>(
    "/food/stats/record",
    converter: (data) => convertListResponse<ChartData>(data, ChartData.fromJson),
  );
}

Future<List<ChartData>> queryCategoryStatsApi() {
  return HttpUtil().get<List<ChartData>>(
    "/food/stats/category",
    converter: (data) => convertListResponse<ChartData>(data, ChartData.fromJson),
  );
}

Future<List<ChartData>> queryRankStatsApi() {
  return HttpUtil().get<List<ChartData>>(
    "/food/stats/rank",
    converter: (data) => convertListResponse<ChartData>(data, ChartData.fromJson),
  );
}